<template>
	<view class="container">
		<tui-msg :type="type" :title="title" :desc="desc" :color="params | getColor">
			<!--自定义内容部分-->
			<tui-button type="green" width="400rpx" height="84rpx" bold margin="32rpx auto 0" @click="returnHome()">回到首页</tui-button>
		
		</tui-msg>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: 'success',
				title: '注册成功',
				desc: '内容详情，根据实际需要进行展示，内容为空则不展示展示',
				params: 0
			}
		},
		filters:{
			getColor(type){
				return ['#07c160','#f74d54','#f74d54','#5677fc'][type || 0]
			}
		},
		onLoad(options) {
			this.title=options.title;
			this.desc= options.desc;
		},
		methods:{
			returnHome(){
				let pages = getCurrentPages(); // 当前页面
				let beforePage = pages[pages.length - 3]; // 上2页
				beforePage.data.refreshIfNeeded = true;
				uni.navigateBack({delta:2})
			}
		} 
	}
</script>

<style>
	.container {
		padding: 0 80rpx;
	}
</style>
